package li.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import li.dao.UserMapper;
import li.dto.TbUser;
import li.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
//为了产生一个UserServiceImpl对象，放到spring容器中。
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper um;
    @Override
    public TbUser doLogin(String account, String password) {
        QueryWrapper q = new QueryWrapper();

        q.eq("account",account);
        q.eq("password",password);
        //select * from tb_user where account='a1' and password='123'
        TbUser user = new TbUser();
        return um.selectOne(q);
    }

    @Override
    public void regist(TbUser user) {
       um.insert(user);
    }
}
